package com.horizon.im.imClient.clientBuilder;

import com.horizon.im.common.bean.UserDTO;
import com.horizon.im.common.bean.msg.ProtoMsg;
import com.horizon.im.imClient.client.ClientSession;
import feign.Client;

public class HeartBeatMsgBuilder extends BaseBuilder {
    private final UserDTO user;
    public HeartBeatMsgBuilder(UserDTO user, ClientSession session) {
        super(ProtoMsg.HeadType.HEART_BEAT, session);
        this.user = user;
    }

    public ProtoMsg.Message buildMsg()
    {
        ProtoMsg.Message message = super.buildCommand(-1);
        ProtoMsg.MessageHeartBeat.Builder lb =
                ProtoMsg.MessageHeartBeat.newBuilder()
                        .setSeq(0)
                        .setJson("{\"from\":\"client\"}")
                        .setUid(user.getUserId());
        return message.toBuilder().setHeartBeat(lb).build();
    }

}
